PVZ108-MODBUS communication driver

 

PVZ108-MODBUS communication driver is the driver to communicate with PVZ108 controller supporting Modbus protocol.

 

1. Read settings

 

<Figure 1> is read setting example of PVZ108-MODBUS communication driver.

<Figure 1> Read setting example of PVZ108-MODBUS communication driver

Device part of  <Figure 1> input Com Port(COM1), Baud Rate(9600), Parity Bit(0), Data Bit(8), Stop Bit(1) respectively according to setting of controller.

In protocol option part, you can set the following: whether to check CRC(1 = check, 0 = don't check), bit write value that corresponds to ON(Default = 65280), protocol type(1 = IP protocol, 0 = Serial protocol), bit write value that corresponds to OFF(Default = 0), whether to use WORD size when reading double/float data(1 = don't use WORD size, 0 = use WORD size, Default = 0), whether to use multi write(0 = Not using multi write, 1 = using multi write, Default = 0), state value saving position for comparison of data(input WORD memory address, Defualt = 1000). Each argument  is a comma-delimited.

 

Note) If you reading 1 DWORD/FLOAT data,  read 1 word data ( not 2 word ) when 'don't use WORD size when reading double/float data' option. ( use GAS Micro iMaCS, .. controller )

MODBUS IP protocol is used in systems that are connected by Ethernet(TCP/IP or UDP/IP).

 

 PVZ108-MODBUS communication driver¡¯s read schedule

Read schedule setting parameters are as follows:

1)     STATION – 0 ~ 255 station number of controller.

2)     Read Command – Read command.

3 – Reading the data of WORD unit.

3D – Reading the data of DWORD unit ( WORD order : LO, HI ).

3d – Reading the data of DWORD unit ( WORD order : HI, LO ).

3lD, 3LD – Reading the data of 8 BYTE unit ( WORD order : LO, HI ).

3ld, 3Ld – Reading the data of 8 BYTE unit ( WORD order : HI, LO ).

3M – Reading the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

3m – Reading the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

3lM, 3LM – Reading the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

3lm, 3Lm – Reading the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

3s – Reading the special data[16 BYTE BCD ASCII].

3F – Reading the data of FLOAT unit ( WORD order : LO, HI ).

3F2 – Reading the data of FLOAT unit ( WORD order : LO, HI ).

3f – Reading the data of FLOAT unit ( WORD order : HI, LO ).

3f2 – Reading the data of FLOAT unit ( WORD order : HI, LO ).

1X, 2X – Reading the data of BIT unit ( 1xxxx, 2xxxx Modbus address ).

1XB, 2XB – Reading the data of BIT unit ( 1xxxx, 2xxxx Modbus address ).

3B – Reading the data of BYTE unit,

68, 68f, 68d, ¡¦ – RAM data WORD/FLOAT/DWORD unit read of PVZ108 controller.

3)     Read Start Address – Input address of equipment ( Modbus address - 1 )

4)     Save Start Address for Communication Server – readed data saving start address of communication server.

5)     Read Size – read size by one packet.

3 –  WORD unit,

3D, 3d, 3M, 3m, 3F, 3F2, 3f, 3f2 – 2 WORD unit,

3LD, 3ld, 3LM, 3lm – 4 WORD unit.

3s – 8 WORD unit,

1X, 2X – WORD unit,

1XB, 2XB – BIT unit ( 1 ~ 15 = 1 WORD, 16 ~ 31 = 2 WORD, ¡¦).

3B – BYTE unit, 

68, 68f, 68d, ¡¦ – WORD, FLOAT, DWORD, ... unit.

 

Read schedule example)

READ,    254,   68,     0,    0,  16,

 

If you click the icon  in protocol option part, you can see the dialog box such as <Figure 2>. you can also set read schedule by using this part. 

<Figure 2> Example of PVZ108-MODBUS communication driver¡¯s Option dialog box

You can set read schedule by using , , button and listbox of <Figure 2>. 

Also, you can set whether to check CRC, bit write value that corresponds to ON, protocol type, bit write value that corresponds to OFF, whether to use WORD size when reading double/float data, whether to use multi write, state value saving position for comparison of data by using the part of ¡®PVZ108-Modbus Protocol Option' shown in <Figure 2>.

<Figure 3> Example of PVZ108-MODBUS communication driver¡¯s read schedule Add/Edit dialog box

When you click Add button or Edit button in dialog box of <Figure 2>, dialog box of <Figure 3> is shown.

 

2. Write settings

You can set PVZ108 controller by using write settings.

 

Digital Write

Digital write setting parameters are as follows:

1)  PORT                   Port no. (0 ~ 255)

2)  STATION             0 ~ 255 station number of PVZ108 controller. ( serial = 1 ~ 255, TCP/IP, UDP/IP = 100, 255, ... )

3)  ADDRESS           decimal unit writing address. ( Modbus address - 1 ).

4) Extra1                    write command. ( 5, ... )

5) Extra2                    don't care.

 

Analog Write

Analog write setting parameters are as follows:

1)  PORT                   Port no. (0 ~ 255)

2)  STATION             0 ~ 255 station number of PVZ108 controller. ( serial = 1 ~ 255, TCP/IP, UDP/IP = 100, 255, ... )

3)  ADDRESS           decimal unit writing address. ( Modbus address - 1 ).

4) Extra1                    write command.

16 – Writing the data of WORD unit.

16D – Writing the data of DWORD unit ( WORD order : LO, HI ).

16d – Writing the data of DWORD unit ( WORD order : HI, LO ).

16lD, 16LD – Writing the data of 8 BYTE unit ( WORD order : LO, HI ).

16ld, 16Ld – Writing the data of 8 BYTE unit ( WORD order : LO, HI ).

16M – Writing the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

16m – Writing the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

16lM, 16LM – Writing the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

16lm, 16Lm – Writing the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

16s – Writing the special data[16 BYTE BCD ASCII].

16F – Writing the data of FLOAT unit ( WORD order : LO, HI ).

16F2 – Writing the data of FLOAT unit ( WORD order : LO, HI ).

16f – Writing the data of FLOAT unit ( WORD order : HI, LO ).

16f2 – Writing the data of FLOAT unit ( WORD order : HI, LO ).

16B – Writing the data of BYTE unit.

16H_TIME – transmit the current time of computer to HICM equipment. (You have to write 6 word one by one - year, month, day, hour, minute, second / only word write) 

5) Extra2                    setting of multi analog write or comparison.

1 = The value for multi word write is stored.  ( Don't care Extar1 part. )

2 = Multi word write is executed. ( The stored quantity is written. )

3 = The value for multi word write is deleted. ( Don't care Extar1 part. )

4 = Compaing the currently stored value to the memory value of the PLC. ( The stored quantity is written )

other Value( 0 or exceeding 4 ) = Normal(one) analog write

 

Write example 1)

PORT:0,  station:1, ADDRESS:0100, Extra1: 16,  Extra2 :

The setting parameter shown above is word data writing example for 100 address ( 101 modbus address ), 1 station PVZ-108 controller.

 

Write example 2)

PORT:0,  station:1, ADDRESS:5000, Extra1: 16d,  Extra2 :

The setting parameter shown above is double word data writing example for 5000 address ( 5001 modbus address ), 1 station PVZ-108 controller.

 

Script setting example for multi write)

$AO_0000.Extra2 = 3;                                            // delete saved data to memory

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                            // setting to multi data saving

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);               // input  a random value in Extra1, not to ignore the same data.

   @SetTagValue("AO_0000", 5000);                      // store the writing value. Here is set to 5000.

}

@sprintf($AO_0000.Extra1, "16");                        // set write command = WORD unit data

$AO_0000.Extra2 = 2;                                            // set to 'multi write'

@SetTagValue("AO_0000", 1);                               // write setting, number of writing data = 50

 

 

Example of script for comparing the current value of PLC with the value of memory)

$AO_CHECK_MEM_SET = 2;                                     // To check the comparison, make WORD address set to 2.

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 2) i = 10;       // An output of value 2 is completed.

   @TagCheckLoop();                                                    // A function to check the tag value changes

}

 

$AO_0000.Extra2 = 3;                                                  // Delete the previously stored value for multi word write.

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                                 // Store the new value for multi word write.

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);                 // Input  a random value in Extra1, not to ignore the same data.

   @SetTagValue("AO_0000", 5000);                        // Store the value for comparison. Here is set to 5000.

}

@sprintf($AO_0000.Extra1, "16");                           // The data type is set to WORD.

$AO_0000.Extra2 = 4;                                                // Compare the values.

@SetTagValue("AO_0000", 1);                                // 50 values are compared.

 

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 1) i = 10;                  // Result 1 = Identical data

   if($AI_CHECK_WRITE_STATUS == 0) {                            // Result 0 = Different data

      @MessageBox("The two data is identical.", "Data comparison completing", MB_OK);

      return;

   }

   @TagCheckLoop();                                                              // A function to check the tag value changes

}

@MessageBox("The two data is different.", "Data comparison error", MB_OK);

 

Note when writing scripts for comparison)

1) The comparison result is stored in preset WORD address. 1 ( Identical data ), 0 ( Different data ).

2) Before comparing the current value of the equipment, input a value other than 1,0 at preset WORD address and confirm the comparison result.

3) AO tag named AO_CHECK_MEM_SET is so set as to output in preset WORD address. ( Extra1 = #MEM# )

4) AI tag named AI_CHECK_WRITE_STATUS is set with WORD address which is preset as PLC_SCAN tag.

 

Block write

Block write is set by using the PlcScanWriteBlock function as follows:  

The fuction name and type : @PlcScanWriteBlock(int port, int station, int address, string extra1, string extra2, object array_value, int array_size);

Example of script)

             ushort   writeVal[5];

 

            writeVal[0] = 1;

            writeVal[1] = 2;

            writeVal[2] = 3;

            writeVal[3] = 4;

            writeVal[4] = 5;

            @PlcScanWriteBlock(0, 1, 5, ¡°16¡±, ¡°¡±, writeVal, 5);

 

Extra1, parameter of block write, is set with one of following command. (You can set any fuction other than 16. If the fuction 0, Extra1 is set with 16(10h) as the default.)

16 – Writing the block data of WORD unit.

16D – Writing the block data of DWORD unit ( WORD order : LO, HI ).

16d – Writing the block data of DWORD unit ( WORD order : HI, LO ).

16lD, 16LD – Writing the block data of 8 BYTE unit ( WORD order : LO, HI ).

16ld, 16Ld – Writing the block data of 8 BYTE unit ( WORD order : LO, HI ).

16M – Writing the special block data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

16m – Writing the special block data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

16lM, 16LM – Writing the special block data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

16lm, 16Lm – Writing the special block data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

16F – Writing the block data of FLOAT unit ( WORD order : LO, HI ).

16F2 – Writing the block data of FLOAT unit ( WORD order : LO, HI ).

16f – Writing the block data of FLOAT unit ( WORD order : HI, LO ).

16f2 – Writing the block data of FLOAT unit ( WORD order : HI, LO ).

16B – Writing the block data of BYTE unit.

 

Important) Block write is supported in SCADA Server 10.1.4.3 or higher version. You can output data up to 250 at once.

 

3. Appearance of PVZ108 controller

<Figure 4> is appearance of PVZ108 controller.
1.png
<Figure 4> Appearance of PVZ108 controller